home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1990 December
/
1990-12.d64
/
high voltage
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
166 lines
1 rem copyright 1990, compute publications int'l, ltd. all rights reserved.
10 v=53248:pokev,0:pokev+1,0:pokev+21,3:pokev+23,0:pokev+29,0:poke53287,1
20 poke2040,13:x=rnd(-ti)
30 fori=832toi+63:pokei,0:next
40 fori=836to886step3:pokei,28:next
50 fori=859to864:pokei,255:next
60 x=11:print"[147]";:poke53280,0:poke53281,0
70 dimv$(25),t(x,x)
80 v$(0)="":fori=1to24:v$(i)=v$(i-1)+"":next
90 gosub1170:gosub1380:printv$(17)tab(26)"[159]wiring board"
100 printtab(26)"please wait..."
110 y1=1:y2=x
120 x1=int(rnd(1)*x)+1
130 t(y1,x1)=2:o1=x1:u1=y1
140 xx=int(rnd(1)*5)+4
150 ifxx=4thenx1=x1-1
160 ifxx=5thenx1=x1+1
170 ifxx=6thenx1=x1-1:y1=y1+1
180 ifxx=7theny1=y1+1
190 ifxx=8theny1=y1+1:x1=x1+1
200 ifx1>xorx1<1ory1>xory1<1thenx1=o1:y1=u1:goto140
210 ift(y1,x1)=0ort(y1,x1)=2thent(y1,x1)=2:goto230
220 x1=o1:y1=u1:goto140
230 ify1<>xthen130
240 x2=int(rnd(1)*x)+1:ift(y2,x2)then240
245 ww=0:t(y2,x2)=5
250 o1=x2:u1=y2
260 xx=int(rnd(1)*5)+4
270 ifxx=4thenx2=x2-1
280 ifxx=5thenx2=x2+1
290 ifxx=6thenx2=x2-1:y2=y2-1
300 ifxx=7theny2=y2-1
310 ifxx=8theny2=y2-1:x2=x2+1
320 ifx2>xorx2<1ory2>xory2<1thenx2=o1:y2=u1:goto260
330 ift(y2,x2)=0thent(y2,x2)=5:goto370
340 ift(y2,x2)=2thenww=ww+1
350 ifww>5theny2=x:x2=int(rnd(1)*x)+1:goto240
360 x2=o1:y2=u1:goto260
370 ify2<>1then250
380 fori=1tox:forj=1tox:ift(i,j)=2ort(i,j)=5then420
390 ux=rnd(1):ifux<.2thent(i,j)=2:goto420
400 ifux>.8thent(i,j)=5:goto420
410 t(i,j)=0
420 nextj,i
430 s1=1:s2=1:t1=x:t2=x
440 poke198,0:pl=int(rnd(1)*2)+1
450 c=0:gosub1330
460 ifpl=2then710
470 u1=s1:u2=s2
480 a=s1:b=s2:poke53287,2:ifc>2then700
490 pokev,b*2*8+20:pokev+1,a*2*8+48:oa=a:ob=b
500 geta$
510 ifa$=""thenb=b+1:goto590
520 ifa$="[157]"thenb=b-1:goto590
530 ifa$="[145]"thena=a-1:goto590
540 ifa$=""thena=a+1:goto590
550 ifa$=chr$(13)then610
560 ifa$="[136]"thenpl=0:goto1040
570 u=peek(56320):gosub1580:ifa$<>""then510
580 goto500
590 ifa<1orb<1ora>xorb>xthena=oa:b=ob:goto490
600 goto490
610 if(s1=1anda>1)or(s1<>1)then630
620 s1=a:s2=b:goto650
630 ifabs(s1-a)>1orabs(s2-b)>1then490
640 s1=a:s2=b
650 pokev,0:pokev+1,0
660 i=s1:j=s2:gosub980:ift(i,j)=5then700
670 ift(i,j)=0thengosub1520:gosub950:s1=u1:s2=u2:c=c+1:goto470
680 gosub1500:gosub950:ifs1<xthen470
690 ww=1:goto1040
700 pl=2:s1=1:s2=1:fl=1:gosub1540:gosub950:goto450
710 v1=t1:v2=t2
720 a=t1:b=t2:poke53287,5:ifc>2then940
730 pokev,b*2*8+20:pokev+1,a*2*8+48:oa=a:ob=b
740 geta$
750 ifa$=""thenb=b+1:goto830
760 ifa$="[157]"thenb=b-1:goto830
770 ifa$=""thena=a+1:goto830
780 ifa$="[145]"thena=a-1:goto830
790 ifa$=chr$(13)then850
800 ifa$="[136]"thenpl=0:goto1040
810 u=peek(56320):gosub1580:ifa$<>""then750
820 goto740
830 ifa<1orb<1ora>xorb>xthena=oa:b=ob:goto730
840 goto730
850 if(t1=xanda<x)or(t1<>x)then870
860 t1=a:t2=b:goto890
870 ifabs(t1-a)>1orabs(t2-b)>1then730
880 t1=a:t2=b
890 pokev,0:pokev+1,0
900 i=t1:j=t2:gosub980:ift(i,j)=2then940
910 ift(i,j)=0thengosub1520:gosub950:t1=v1:t2=v2:c=c+1:goto710
920 gosub1500:gosub950:ift1<>1then710
930 ww=2:goto1040
940 pl=1:t1=x:t2=x:fl=1:gosub1540:gosub950:goto450
950 ifi=7thenprintv$(i*2-1)tab(40+j*2)"[176][174][157][157][173][189]":goto970
960 printv$(i*2)tab(j*2)"[176][174][157][157][173][189]";
970 return
980 ift(i,j)=2thenprint"";
990 ift(i,j)=5thenprint"";
1000 ift(i,j)=0thenprint"[144]";
1010 ifi=7thenprintv$(i*2-1)tab(40+j*2)"[213][201][157][157][202][203]";:goto1030
1020 printv$(i*2)tab(j*2)"[213][201][157][157][202][203]";
1030 return
1040 pokev+21,0:fori=1tox:forj=1tox:gosub980:nextj,i
1050 gosub1540:ifpl=0then1120
1060 printv$(10)tab(5)"[146][176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
1070 printtab(5)"[221] [221]"
1080 printtab(5)"[221] [158]the winner is [221]"
1090 printtab(5)"[221] [158]player #"pl:printv$(13)tab(17)" ! [221]"
1100 printtab(5)"[221] [221]"
1110 printtab(5)"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
1120 printv$(17)tab(26)"[146][159]press any key"
1130 printtab(26)" or <fire> "
1140 printv$(19)tab(66)"to play again"
1150 geta$:u=peek(56320):ifa$<>""oru=111thenrun
1160 goto1150
1170 a1$="[151] ":a2$=a1$
1180 ta(1)=0:ta(2)=2:ta(3)=5
1190 fori=1to11:a1$=a1$+"[176][174]":next
1200 aa$=aa$+"[151] "+chr$(13)+" [154]"
1210 fori=1to11:a2$=a2$+"[173][189]":next
1220 gosub1290:gosub1380:gosub1540
1230 printv$(17)tab(26)"[159]press any key"
1240 printtab(26)"to begin..."
1250 i=int(rnd(1)*11)+1:j=int(rnd(1)*11)+1:t(i,j)=ta(int(rnd(1)*3)+1)
1260 gosub980:t(i,j)=0:geta$:u=peek(56320):ifa$<>""oru=111then1280
1270 goto1250
1280 gosub1290:return
1290 print"[147][151]";
1300 fori=1to12:print" ";:next:print
1310 fori=1to11:printa1$"[151] ":printa2$"[151] ":next
1320 print"[151]";:fori=1to12:print" ";:next:return
1330 printv$(17)tab(26)"[146][176][192][192][192][192][192][192][192][192][192][192][174]"
1340 printtab(26)"[221]";:print"";:ifpl=2thenprint"";
1350 print" player"pl:printv$(18)tab(36)" [221] "
1360 printv$(19)tab(66)"[146][173][192][192][192][192][192][192][192][192][192][192][189]":return
1370 printv$(3)tab(28)"[146] [169] [223]"
1380 h=26:printv$(3)tab(h)"[146] [158][169] [146][169]"
1390 printtab(h)" [169] [146][169]"
1400 printtab(h)" [169] [146][169]"
1410 printtab(h)" [169] [146][169]"
1420 printtab(h)" [169] [146][169]"
1430 printtab(h)" [169] [146][169]"
1440 printtab(h)" [169] [146][169]"
1450 printtab(h)" [169] [146][169]"
1460 printtab(h)" [169] [146][169]"
1470 printtab(h)" [169][146][169]"
1480 printtab(h)" [169][146][169]"
1490 printv$(9)tab(26)"[158][146]high[169][146]voltage!":return
1500 poke54273,70:poke54278,249:poke54296,15:poke54276,17:poke54276,16
1510 fordy=1to500:next:poke54273,0:return
1520 forp=1to15:poke54296,15:poke54296,0:next:return
1530 forb=1to250step3:poke54273,b:next:poke54296,0:fl=0:return
1540 forp=54272to54295:pokep,0:next:poke54296,15
1550 poke54277,8:poke54278,255:poke54276,23:a=6:poke54287,a:ifflthen1530
1560 forb=1to150:poke54273,b:a=a-.01:next
1570 gosub1500:poke54296,0:return
1580 a$="":ifu=111thena$=chr$(13)
1590 ifu=119thena$=""
1600 ifu=123thena$="[157]"
1610 ifu=126thena$="[145]"
1620 ifu=125thena$=""
1630 return